<!DOCTYPE html>
<html>
	<title>Личный кабинет бота</title>
<?php require_once('head.php');  ?>
<body>


<div style="color: white;">

<?php 
	require_once('menu.php'); 
	require_once('functions.php'); 
	$id = (int)$_GET['i'];
	if (!$id) redirect_php('/');
// достаем золото SELECT SUM( gold ) FROM  `aa_gold` WHERE user_id =1261

    $q = "SELECT
	SUM(gold) , ROUND (
	SUM(gold*(
		SELECT
			exchangeRate
		FROM
			aa_warehouses
		WHERE
		aa_warehouses.server =
			(
			SELECT server
			from accounts
			WHERE accounts.id = aa_gold.user_id
			)
		)
	) , 2 ) AS r
FROM
	`aa_gold`
WHERE user_id = ".$id;
    $money = mysql_query($q) or die("error 33");
$money =  mysql_fetch_row($money);


// достаем золото SELECT SUM( gold ) FROM  `aa_gold` WHERE user_id =1261

	$query = "SELECT * ,  DATEDIFF( NOW( ) , create_date ) +1 FROM accounts WHERE id = ".$id."  LIMIT 1";
	$result = mysql_query($query) or die("error 33");
	for ($c=0; $c<mysql_num_rows($result); $c++)
	{
		$t = mysql_fetch_row($result);
//		echo "<br><br>id =".$t[0]."<br>";
//	//	echo "mailid =".$t[1]."<br>";
//		echo "Ник = ".$t[2]."<br>";
//		echo "Сервер = ".$t[3]."<br>";
//		echo "Комп =".$t[4]."<br>";
//		echo "Последняя активность =".$t[5]."<br>";
//		echo "Левел = ".$t[13]."<br>";
//		echo "Голды = ".$t[14]."<br>";
//		echo "Мешков =".$t[15]."<br>";
//        echo "Дней ебашит = ".$t[17]." (Сжег ".($t[17]*15)." р.)<br>";
//        echo "Принес = ".$money[0]." г. (".$money[1]."р.)<br>";
    }
?>
<div class="bg-info"  style="padding: 10px; color: #000000"><h2>Итого баланс:  <?php  echo $money[1]-$t[18]*15; ?> р.</h2></div>
</div>

<div class=" pretty-table ">
    <link rel="stylesheet" href="/css/pretty-table.css">





    <table class="features-table ">
        <thead>
        <tr>
            <td>Параметр</td>
            <td class="green">Значение</td>
        </tr>
        </thead>

<!--        <tfoot>-->
<!--        <tr>-->
<!--            <td nowrap>Итого по размерам</td>-->
<!--            <td class="grey">Мелкие</td>-->
<!--            <td class="grey">Средние</td>-->
<!--            <td class="green">Крупные</td>-->
<!--        </tr>-->
<!--        </tfoot>-->

        <tbody>
        <tr>
            <td nowrap>id</td>
            <td class="green"><?=$t[0] ?></td>
        </tr>
        <tr>
            <td nowrap>Ник</td>
            <td class="green"><?=$t[2] ?></td>
        </tr>
        <tr>
            <td nowrap>Сервер</td>
            <td class="green"><?=$t[3] ?></td>
        </tr>
        <tr>
            <td nowrap>Комп</td>
            <td class="green"><?=$t[4] ?></td>
        </tr>
        <tr>
            <td nowrap>Последняя активность</td>
            <td class="green"><?=$t[5] ?></td>
        </tr>
        <tr>
            <td nowrap>Левел</td>
            <td class="green"><?=$t[13] ?></td>
        </tr>
        <tr>
            <td nowrap>Голды</td>
            <td class="green"><?=$t[14] ?></td>
        </tr>
        <tr>
            <td nowrap>Мешков</td>
            <td class="green"><?=$t[15] ?></td>
        </tr>
        <tr>
            <td nowrap>Дней ебашит</td>
            <td class="green"><?=$t[18] ?></td>
        </tr>
        <tr>
            <td nowrap>Сжег денег</td>
            <td class="green"><?=($t[18]*15 )?>р.</td>
        </tr>
        <tr>
            <td nowrap>Принес голды</td>
            <td class="green"><?=$money[0] ?></td>
        </tr>
        <tr>
            <td nowrap>Принес рубасей</td>
            <td class="green"><?=$money[1] ?></td>
        </tr>

        </tbody>
    </table>


</div>



</body>
<html>
